using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
using System.Web.Script.Serialization;
using System.Collections.Generic;
using HMS.BL;
using HMS.Common;
using HMS.DL;

public partial class _demo_Callback : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {
        //Response.AddHeader("","");
        if (IsPostBack == false)
        {

            string strOpern = String.IsNullOrEmpty(Request.QueryString["operation"]) ? "" : Request.QueryString["operation"].ToString();
            NodeData objNodeData = new NodeData();

            if (String.IsNullOrEmpty(Request.QueryString["reconstruct"]) == false)
            {
                return;
            }

            switch (strOpern)
            {

                case "get_types"://done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.VersionId = String.IsNullOrEmpty(Request.QueryString["vers_id"]) ? 0 : Convert.ToInt32(Request.QueryString["vers_id"].ToString());
                    objNodeData.IsNodeType = String.IsNullOrEmpty(Request.QueryString["isNodeType"]) ? false : Convert.ToBoolean(Request.QueryString["isNodeType"].ToString());
                    Response.Write(objNodeData.GetTypes());
                    break;
                case "get_children"://done 
                    objNodeData.ParentId = String.IsNullOrEmpty(Request.QueryString["id"]) ? 0 : Convert.ToInt32(Request.QueryString["id"].ToString());
                    objNodeData.IsRoot = String.IsNullOrEmpty(Request.QueryString["root_flag"]) ? false : Convert.ToBoolean(Request.QueryString["root_flag"].ToString());
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    //string strDate = Request.QueryString["txtdate"];
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    Response.Write(objNodeData.GetChildren());
                    break;
                case "select_item"://done
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["id"]) ? 0 : Convert.ToInt32(Request.QueryString["id"].ToString());
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    objNodeData.NodeTypeId = String.IsNullOrEmpty(Request.QueryString["type_id"]) ? 0 : Convert.ToInt32(Request.QueryString["type_id"].ToString());
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.VersionId = String.IsNullOrEmpty(Request.QueryString["vers_id"]) ? 0 : Convert.ToInt32(Request.QueryString["vers_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    Response.Write(objNodeData.GetAttributes());
                    break;
                case "rename_node"://done
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["id"]) ? 0 : Convert.ToInt32(Request.QueryString["id"].ToString());
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    objNodeData.NewNodeName = Request.QueryString["new_name"].ToString();
                    Response.Write(objNodeData.UpdateNodeName());
                    break;
                case "bind_hierarchy"://done
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"].ToString());
                    Response.Write(objNodeData.GetHierarchies());
                    break;
                case "bind_version"://done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["id"]) ? 0 : Convert.ToInt32(Request.QueryString["id"].ToString());
                    Response.Write(objNodeData.GetVersions());
                    break;
                case "save_attributes"://done
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["id"]) ? 0 : Convert.ToInt32(Request.QueryString["id"].ToString());
                    objNodeData.NodeTypeId = String.IsNullOrEmpty(Request.QueryString["type_id"]) ? 0 : Convert.ToInt32(Request.QueryString["type_id"].ToString());
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    objNodeData.AttrVal = Request.QueryString["atrrVal"].ToString();
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.VersionId = String.IsNullOrEmpty(Request.QueryString["vers_id"]) ? 0 : Convert.ToInt32(Request.QueryString["vers_id"].ToString());
                    //objNodeData.bsave = String.IsNullOrEmpty(Request.QueryString["bsave"]) ? '0'  : Convert.ToChar(Request.QueryString["bsave"]);
                    Response.Write(objNodeData.SaveAttributes());
                    break;
                case "reconstruct":
                    //Response.Write(objNodeData.SaveAttributes());
                    break;
                case "create_child"://done
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["id"]) ? 0 : Convert.ToInt32(Request.QueryString["id"].ToString());
                    objNodeData.NodeTypeId = String.IsNullOrEmpty(Request.QueryString["type_id"]) ? 0 : Convert.ToInt32(Request.QueryString["type_id"].ToString());
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.VersionId = String.IsNullOrEmpty(Request.QueryString["vers_id"]) ? 0 : Convert.ToInt32(Request.QueryString["vers_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    Response.Write(objNodeData.CreateChild());
                    break;
                case "create_node": //done                
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.NodeTypeId = String.IsNullOrEmpty(Request.QueryString["type_id"]) ? 0 : Convert.ToInt32(Request.QueryString["type_id"].ToString());
                    objNodeData.VersionId = String.IsNullOrEmpty(Request.QueryString["vers_id"]) ? 0 : Convert.ToInt32(Request.QueryString["vers_id"].ToString());
                    objNodeData.ParentId = String.IsNullOrEmpty(Request.QueryString["id"]) ? 0 : Convert.ToInt32(Request.QueryString["id"].ToString());
                    objNodeData.NewNodeName = Request.QueryString["new_name"].ToString();
                    objNodeData.NewNodeTypeId = Request.QueryString["newnode_typeid"].ToString();
                    Response.Write(objNodeData.CreateNode());
                    break;
                case "move_node"://to do later
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["id"]) ? 0 : Convert.ToInt32(Request.QueryString["id"].ToString());
                    objNodeData.NodeTypeId = String.IsNullOrEmpty(Request.QueryString["type_id"]) ? 0 : Convert.ToInt32(Request.QueryString["type_id"].ToString());
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    objNodeData.RefNodeId = String.IsNullOrEmpty(Request.QueryString["refid"]) ? 0 : Convert.ToInt32(Request.QueryString["refid"].ToString());
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.VersionId = String.IsNullOrEmpty(Request.QueryString["vers_id"]) ? 0 : Convert.ToInt32(Request.QueryString["vers_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    objNodeData.bmoveRelflag = String.IsNullOrEmpty(Request.QueryString["bmoveRelflag"]) ? false : Convert.ToBoolean(Request.QueryString["bmoveRelflag"]);
                    Response.Write(objNodeData.MoveNode1());
                    break;

                case "remove_node"://done
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["id"]) ? 0 : Convert.ToInt32(Request.QueryString["id"].ToString());
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    Response.Write(objNodeData.RemoveNode());
                    break;
                case "check_date"://done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.VersionId = String.IsNullOrEmpty(Request.QueryString["vers_id"]) ? 0 : Convert.ToInt32(Request.QueryString["vers_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    Response.Write(objNodeData.CheckNode());
                    break;
                case "get_dim"://done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    Response.Write(objNodeData.GetDim());
                    break;

                case "get_gridColdata"://done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.dimname = Request.QueryString["dimname"].ToString();
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["node_id"]) || Request.QueryString["node_id"] == "undefined" ? 0 : Convert.ToInt32(Request.QueryString["node_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    Response.Write(objNodeData.GetDimGriddata(false));
                    break;

                case "get_griddata"://done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.dimname = Request.QueryString["dimname"].ToString();
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["node_id"]) ? 0 : Convert.ToInt32(Request.QueryString["node_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    //Response.Write(objNodeData.GetDimGriddata(true));
                    objNodeData.sidx = String.IsNullOrEmpty(Request.Params["sidx"]) ? "" : Convert.ToString(Request.Params["sidx"].ToString());
                    objNodeData.sord = String.IsNullOrEmpty(Request.Params["sord"]) ? "desc" : Convert.ToString(Request.Params["sord"].ToString());
                    objNodeData.rows = String.IsNullOrEmpty(Request.Params["rows"]) ? 10 : Convert.ToInt32(Request.Params["rows"].ToString());
                    objNodeData.page = String.IsNullOrEmpty(Request.Params["page"]) ? 1 : Convert.ToInt32(Request.Params["page"].ToString());
                    objNodeData._search = String.IsNullOrEmpty(Request.Params["_search"]) ? false : Convert.ToBoolean(Request.Params["_search"]);
                    objNodeData.query = String.IsNullOrEmpty(Request.Params["searchQuery"]) ? "" : Convert.ToString(Request.Params["searchQuery"]);
                    Response.Write(objNodeData.GetjqgridData("exist"));
                    break;

                case "refresh_grid"://done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.dimname = Request.QueryString["dimname"].ToString();
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["node_id"]) ? 0 : Convert.ToInt32(Request.QueryString["node_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    //Response.Write(objNodeData.GetDimGriddata(true));
                    objNodeData.sidx = String.IsNullOrEmpty(Request.Params["sidx"]) ? "" : Convert.ToString(Request.Params["sidx"].ToString());
                    objNodeData.sord = String.IsNullOrEmpty(Request.Params["sord"]) ? "desc" : Convert.ToString(Request.Params["sord"].ToString());
                    objNodeData.rows = String.IsNullOrEmpty(Request.Params["rows"]) ? 10 : Convert.ToInt32(Request.Params["rows"].ToString());
                    objNodeData.page = String.IsNullOrEmpty(Request.Params["page"]) ? 1 : Convert.ToInt32(Request.Params["page"].ToString());
                    objNodeData._search = String.IsNullOrEmpty(Request.Params["_search"]) ? false : Convert.ToBoolean(Request.Params["_search"]);
                    objNodeData.query = String.IsNullOrEmpty(Request.Params["searchQuery"]) ? "" : Convert.ToString(Request.Params["searchQuery"]);
                    Response.Write(objNodeData.GetjqgridData("exist"));
                    break;
                //case "get_griddataUn":
                //    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                //    objNodeData.dimname = Request.QueryString["dimname"].ToString();
                //    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                //    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                //    Response.Write(objNodeData.GetDimGriddataUnasgn(false));
                //    break;

                case "remove_rel"://done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.dimname = Request.QueryString["dimname"].ToString();
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    objNodeData.arrRelId = Request.QueryString["Ids"].Split(',');      
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["node_id"]) ? 0 : Convert.ToInt32(Request.QueryString["node_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    objNodeData.RemoveRel();
                    objNodeData.sidx = String.IsNullOrEmpty(Request.Params["sidx"]) ? "" : Convert.ToString(Request.Params["sidx"].ToString());
                    objNodeData.sord = String.IsNullOrEmpty(Request.Params["sord"]) ? "desc" : Convert.ToString(Request.Params["sord"].ToString());
                    objNodeData.rows = String.IsNullOrEmpty(Request.Params["rows"]) ? 10 : Convert.ToInt32(Request.Params["rows"].ToString());
                    objNodeData.page = String.IsNullOrEmpty(Request.Params["page"]) ? 1 : Convert.ToInt32(Request.Params["page"].ToString());
                    objNodeData._search = String.IsNullOrEmpty(Request.Params["_search"]) ? false : Convert.ToBoolean(Request.Params["_search"]);
                    objNodeData.query = String.IsNullOrEmpty(Request.Params["searchQuery"]) ? "" : Convert.ToString(Request.Params["searchQuery"]);
                    Response.Write(objNodeData.GetjqgridData("exist"));
                    break;

                case "add_relUnassign"://done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.VersionId = String.IsNullOrEmpty(Request.QueryString["vers_id"]) ? 0 : Convert.ToInt32(Request.QueryString["vers_id"].ToString());
                    objNodeData.dimname = Request.QueryString["dimname"].ToString();
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    objNodeData.arrRelId = Request.QueryString["Ids"].Split(',');
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["node_id"]) ? 0 : Convert.ToInt32(Request.QueryString["node_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);                    
                    objNodeData.AddRel();              
                    break;

                case "get_griddataAddRel"://done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.dimname = Request.QueryString["dimname"].ToString();
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["node_id"]) ? 0 : Convert.ToInt32(Request.QueryString["node_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    Response.Write(objNodeData.GetAddRelGridData(false));
                    break;

                case "get_griddataAddRelDRow"://done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.dimname = Request.QueryString["dimname"].ToString();
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["node_id"]) ? 0 : Convert.ToInt32(Request.QueryString["node_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    objNodeData.sidx = String.IsNullOrEmpty(Request.Params["sidx"]) ? "" : Convert.ToString(Request.Params["sidx"].ToString());
                    objNodeData.sord = String.IsNullOrEmpty(Request.Params["sord"]) ? "desc" : Convert.ToString(Request.Params["sord"].ToString());
                    objNodeData.rows = String.IsNullOrEmpty(Request.Params["rows"]) ? 10 : Convert.ToInt32(Request.Params["rows"].ToString());
                    objNodeData.page = String.IsNullOrEmpty(Request.Params["page"]) ? 1 : Convert.ToInt32(Request.Params["page"].ToString());
                    objNodeData._search = String.IsNullOrEmpty(Request.Params["_search"]) ? false : Convert.ToBoolean(Request.Params["_search"]);
                    objNodeData.query = String.IsNullOrEmpty(Request.Params["searchQuery"]) ? "" : Convert.ToString(Request.Params["searchQuery"]);
                    Response.Write(objNodeData.GetjqgridData("addrel"));
                    break;
                case "add_rel"://done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.VersionId = String.IsNullOrEmpty(Request.QueryString["vers_id"]) ? 0 : Convert.ToInt32(Request.QueryString["vers_id"].ToString());
                    objNodeData.dimname = Request.QueryString["dimname"].ToString();
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    objNodeData.arrRelId = Request.QueryString["Ids"].Split(',');
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["node_id"]) ? 0 : Convert.ToInt32(Request.QueryString["node_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    objNodeData.AddRel();
                    break;
                case "remove_relRule"://done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.dimname = Request.QueryString["dimname"].ToString();
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    objNodeData.arrRelId = Request.QueryString["Ids"].Split(',');
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["node_id"]) ? 0 : Convert.ToInt32(Request.QueryString["node_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    objNodeData.query = Convert.ToString(Request.QueryString["queryRel"]);
                    objNodeData.RemoveRel();
                    Response.Write(true);
                    break;
                case "add_relRule"://done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.VersionId = String.IsNullOrEmpty(Request.QueryString["vers_id"]) ? 0 : Convert.ToInt32(Request.QueryString["vers_id"].ToString());
                    objNodeData.dimname = Request.QueryString["dimname"].ToString();
                    objNodeData.arrRelId = Request.QueryString["Ids"].Split(',');
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["node_id"]) ? 0 : Convert.ToInt32(Request.QueryString["node_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    objNodeData.query = Convert.ToString(Request.QueryString["queryRel"]);
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    Response.Write(objNodeData.AddRel());
                    //Response.Write(objNodeData.GetRelColAcRule(false));
                    break;
                case "getRelColData"://done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.VersionId = String.IsNullOrEmpty(Request.QueryString["vers_id"]) ? 0 : Convert.ToInt32(Request.QueryString["vers_id"].ToString());
                    objNodeData.dimname = Request.QueryString["dimname"].ToString();
                    //objNodeData.arrRelId = Request.QueryString["Ids"].Split(',');
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["node_id"]) ? 0 : Convert.ToInt32(Request.QueryString["node_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    objNodeData.query = Convert.ToString(Request.QueryString["queryRel"]);
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    Response.Write(objNodeData.GetRelColAcRule(false));//GetRelColAcRule
                    break;

                case "getRelDataNew": //done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.VersionId = String.IsNullOrEmpty(Request.QueryString["vers_id"]) ? 0 : Convert.ToInt32(Request.QueryString["vers_id"].ToString());
                    objNodeData.dimname = Request.QueryString["dimname"].ToString();
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["node_id"]) ? 0 : Convert.ToInt32(Request.QueryString["node_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    objNodeData.queryRel = Convert.ToString(Request.QueryString["queryRel"]);
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    objNodeData.sidx = String.IsNullOrEmpty(Request.Params["sidx"]) ? "" : Convert.ToString(Request.Params["sidx"].ToString());
                    objNodeData.sord = String.IsNullOrEmpty(Request.Params["sord"]) ? "desc" : Convert.ToString(Request.Params["sord"].ToString());
                    objNodeData.rows = String.IsNullOrEmpty(Request.Params["rows"]) ? 10 : Convert.ToInt32(Request.Params["rows"].ToString());
                    objNodeData.page = String.IsNullOrEmpty(Request.Params["page"]) ? 1 : Convert.ToInt32(Request.Params["page"].ToString());
                    objNodeData._search = String.IsNullOrEmpty(Request.Params["_search"]) ? false : Convert.ToBoolean(Request.Params["_search"]);
                    objNodeData.query = String.IsNullOrEmpty(Request.Params["searchQuery"]) ? "" : Convert.ToString(Request.Params["searchQuery"]);
                    Response.Write(objNodeData.GetRelDataNewAcRule(false));
                    break;
                case "getRelDataRem": //done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.VersionId = String.IsNullOrEmpty(Request.QueryString["vers_id"]) ? 0 : Convert.ToInt32(Request.QueryString["vers_id"].ToString());
                    objNodeData.dimname = Request.QueryString["dimname"].ToString();
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["node_id"]) ? 0 : Convert.ToInt32(Request.QueryString["node_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    objNodeData.queryRel = Convert.ToString(Request.QueryString["queryRel"]);
                    objNodeData.TableName = Request.QueryString["table_name"].ToString();
                    objNodeData.sidx = String.IsNullOrEmpty(Request.Params["sidx"]) ? "" : Convert.ToString(Request.Params["sidx"].ToString());
                    objNodeData.sord = String.IsNullOrEmpty(Request.Params["sord"]) ? "desc" : Convert.ToString(Request.Params["sord"].ToString());
                    objNodeData.rows = String.IsNullOrEmpty(Request.Params["rows"]) ? 10 : Convert.ToInt32(Request.Params["rows"].ToString());
                    objNodeData.page = String.IsNullOrEmpty(Request.Params["page"]) ? 1 : Convert.ToInt32(Request.Params["page"].ToString());
                    objNodeData._search = String.IsNullOrEmpty(Request.Params["_search"]) ? false : Convert.ToBoolean(Request.Params["_search"]);
                    objNodeData.query = String.IsNullOrEmpty(Request.Params["searchQuery"]) ? "" : Convert.ToString(Request.Params["searchQuery"]);
                    Response.Write(objNodeData.GetRelDataRemAcRule(false));
                    break;
                case "saveRule": //done
                    objNodeData.HierarchyId = String.IsNullOrEmpty(Request.QueryString["hier_id"]) ? 0 : Convert.ToInt32(Request.QueryString["hier_id"].ToString());
                    objNodeData.VersionId = String.IsNullOrEmpty(Request.QueryString["vers_id"]) ? 0 : Convert.ToInt32(Request.QueryString["vers_id"].ToString());
                    objNodeData.dimname = Request.QueryString["dimname"].ToString();
                    objNodeData.NodeId = String.IsNullOrEmpty(Request.QueryString["node_id"]) ? 0 : Convert.ToInt32(Request.QueryString["node_id"].ToString());
                    objNodeData.txtDate = Functions.GetDate(Request.QueryString["txtdate"]);
                    objNodeData.query = Convert.ToString(Request.QueryString["queryRel"]);
                    objNodeData.queryObj = Convert.ToString(Request.QueryString["queryObj"]);
                    objNodeData.bCurrRule = Convert.ToBoolean(Request.QueryString["bCurrRule"]);
                    Response.Write(objNodeData.SaveRule());
                    break;
                default:
                    Response.Write(objNodeData.GetHierarchies());
                    break;
            }
        }
    }
}
